<?php
// Luu dieu kien loc theo linh vuc 
if(isset($_REQUEST['hdn_page'])){
	$v_page=$_REQUEST['hdn_page'];
}else{
	$v_page=1;
}

//Begin//Xay dung chuoi XML chua gia tri
$v_list_xml_tag = "";
if(isset($_REQUEST['hdn_list_xml_tag'])){
	$v_list_xml_tag = $_REQUEST['hdn_list_xml_tag'];
}
$v_list_xml_value = "";
if(isset($_REQUEST['hdn_list_xml_value'])){
	$v_list_xml_value = $_REQUEST['hdn_list_xml_value'];
}
$v_xml_str = '<?xml version="1.0" encoding="UTF-8"?><root><data_list>';
for ($i=0; $i<_list_get_len($v_list_xml_tag,_CONST_SUB_LIST_DELIMITOR); $i++){
	$v_xml_str = $v_xml_str ."<"._list_get_at($v_list_xml_tag,$i,_CONST_SUB_LIST_DELIMITOR).">";
	$v_xml_str = $v_xml_str .trim(_replace_XML_bad_char(_list_get_at($v_list_xml_value,$i,_CONST_SUB_LIST_DELIMITOR)));
	$v_xml_str = $v_xml_str ."</"._list_get_at($v_list_xml_tag,$i,_CONST_SUB_LIST_DELIMITOR).">";
}
$v_xml_str = $v_xml_str . "</data_list></root>";

$v_citizen_name = '';
if(isset($_REQUEST['hdn_list_xml_tag'])){
	$rax = new RAX(); 
	$rec = new RAX(); 
	$rax->open($v_xml_str);
	$rax->record_delim = "data_list";
	$rax->parse();
	$rec = $rax->readRecord(); 
	$row = $rec->getRow();
	$v_citizen_name = _restore_XML_bad_char($row["citizen_name"]);
}

$v_number_of_row = _CONST_NUMBER_OF_ROW_PER_LIST;
if(_is_sqlserver()){
	$sql = "Exec Onegate_CitizenGetAll";
	$sql = $sql . " '" . $v_citizen_name . "'";
	$sql = $sql . "," . $v_page . "" ;
	$sql = $sql . "," . $v_number_of_row . "" ;

	//echo $sql; //exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$arr_all_citizen = $ado_conn->GetAll($sql);
}
?>